package com.huaxin.feignclient.device.models;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.huaxin.feignclient.device.models.enums.DeviceStatus;
import com.huaxin.feignclient.device.models.enums.DeviceType;
import com.huaxin.feignclient.system.models.BaseModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 设备实例表
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class DeviceInstance extends BaseModel {

    /**
     * 唯一序列号
     */
    @Schema(description = "唯一序列号", example = "SN123456789")
    private String serialNumber;

    /**
     * 自定义名称
     */
    @Schema(description = "设备名称", example = "厨房断路器1号")
    private String deviceName;

    /**
     * 关联型号ID
     */
    @Schema(description = "型号ID", example = "m123e456-789a-bcde-f012-3456789abcde")
    private String modelId;

    /**
     * 冗余型号编码
     */
    @Schema(description = "型号编码", example = "CB-2023A")
    private String modelCode;

    /**
     * 设备类型
     */
    @Schema(description = "设备类型", example = "circuit_breaker")
    private String deviceType;

    /**
     * 安装区域ID
     */
    @Schema(description = "区域ID", example = "z123e456-789a-bcde-f012-3456789abcde")
    private String zoneId;

    /**
     * 区域名称冗余
     */
    @Schema(description = "区域名称", example = "厨房区域")
    private String zoneName;

    /**
     * 状态：1=在线，0=离线，2=故障，3=停用，4=报废
     */
    @Schema(description = "状态：1=在线，0=离线，2=故障，3=停用，4=报废", example = "1")
    private String status;

    /**
     * 最后心跳时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "最后心跳时间", example = "2025-08-17 16:00:00")
    private LocalDateTime lastHeartbeat;

    /**
     * 安装时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "安装时间", example = "2023-01-15 09:00:00")
    private LocalDateTime installDate;

    /**
     * 预计更换日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Schema(description = "预计更换日期", example = "2028-01-15")
    private String expectedReplacementDate;

    /**
     * 实际更换/报废时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Schema(description = "实际更换/报废日期", example = "2027-11-20")
    private String actualReplacementDate;

    /**
     * 固件版本
     */
    @Schema(description = "固件版本", example = "v2.1.5")
    private String firmwareVersion;

    /**
     * 详细安装位置
     */
    @Schema(description = "详细安装位置", example = "厨房配电箱第3排第2列")
    private String installLocation;

    /**
     * 组织家族ID
     */
    @Schema(description = "组织家族ID", example = "f3b2f8e1-4c5d-4e6f-8b2a-1c2d3e4f5a6b")
    private String familyId;
    /**
     * 绑定状态：0-未绑定；1-已绑定了
     */
    @Schema(description = "0-未绑定；1-已绑定了；", example = "1")
    private Integer bindStatus;
}